home *** CD-ROM | disk | FTP | other *** search
- ;********************************
- pushreg macro
- push ax
- push bx
- push cx
- push dx
- endm
-
- popreg macro
- pop dx
- pop cx
- pop bx
- pop dx
- endm
-
-
- ;******************************************************************
- pile segment para stack 'pile' ; définit
- db 256 dup(0) ; la
- pile ends ; pile
- ;******************************************************************
-
- ;******************************************************************
- donnees segment para public 'donnees'
-
- back db 64000 dup(?) ; place pour image fond
-
- ball: ; sprite ball
- include c:\masm\data\ball.nda
-
- donnees ends
- ;******************************************************************
-
-
- .286P
- code segment para public 'code'
- assume cs:code, ss:pile, ds:code
-
-
- maitre:
-
- ; mov dx,3d4h ; Trident 128 ko Page
- ; mov ax,10*256+1fh
- ; out dx,ax
-
- mov ax,0013h ; 320x200 256 Couleurs
- int 10h
-
- ; mov dx,3d4h ; modulo page
- ; mov ax,40*256+13h ; = Normal (40*8 plans = 320 oct)
- ; out dx,ax
-
- ; mov dx,3c2h
- ; mov al,11100011b ; 0E3h
- ; out dx,al ; 60 hz
-
- ; mov dx,3d4h
- ; mov ax,9 ; 320x400
- ; out dx,ax
-
- ; mov dx,3d4h ; 204 lignes
- ; mov ax,156*256+12h
- ; out dx,ax
- ; mov ax,255*256+15h ; 208 lignes
- ; out dx,ax
-
- ; mov dx,3d4h ;??? Kronch ???
- ; mov ax,200*256+14h
- ; out dx,ax
-
-
- ; Affiche Image et Initialise Palette
- ;_____________________________________
-
- mov ax,01012h
- xor bx,bx
- mov cx,256
- mov dx,cs
- mov es,dx
- lea dx,palet
- int 10h
-
- ;************* Load Picture **************
- mov ax,cs
- mov ds,ax
- mov ax,03d00h
- lea dx,image
- int 21h
-
- mov bx,ax
- mov ah,03fh
- mov cx,64000
- mov dx,seg back
- mov ds,dx
- mov dx,offset back
- int 21h
-
- mov ah,03eh
- int 21h
-
- cld
- mov si,seg back ; copy BackGround to Screen Memory
- mov ds,si
- mov si,offset back
- mov di,0a000h
- mov es,di
- xor di,di ;mov di,8*320
- mov cx,32000
- rep movsw
-
- mov ax,cs
- mov ds,ax
-
- ;*****************************************
-
- cli ;Int Off
-
- mov ax,cs
- mov ds,ax
- mov ax,3508h ;lire adr IRQ0
- int 21h
- mov timer,bx
- mov timer+2,es ;sauver
-
- mov ax,cs
- mov ds,ax
- mov ax,2508h ;placer ma IRQ0
- lea dx,raster ;ds=code
- int 21h
-
- mov al,182 ;Timer : 15750 Khz
- out 43h,al
- mov al,76 ;1193180/15750=76
- out 40h,al
- xor al,al
- out 40h,al
-
- mov al,11111110b ;autorise only my IRQ0
- out 021h,al
- mov al,11111111b
- out 0a1h,al
-
- mov si,cs ; !!!!!!!
- mov ds,si ; !!!!!!!
- lea si,colors_table
- mov pok,si
-
- call wait_hbl
-
- sti ;Int On
- main:
-
- call wait_vbl
-
- ;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-
- lea si,colors_table
- mov pok,si
-
- cld
-
- mov di,cs ; clear rasters page
- mov es,di
- lea di,colors_table
- lea si,fond
- mov cx,300*3/2
- rep movsw
-
- mov ax,rolo_pt ; pointeur sinus
- add ax,2*2 ; incrément
- and ax,1023
- mov rolo_pt,ax
-
- lea bx,rolo_sin ; prendre 1er sinus
- add bx,ax
- mov ax,[bx]
- ;*********************************************
- lea si,rolo1 ; affichage rouleaux
- lea dx,colors_table ; 1er rouleau
- mov di,dx
- add di,ax
- mov cx,30*3/2
- rep movsw
-
- rept 4
-
- add bx,32 ; autres rouleaux
- mov ax,[bx]
- mov di,dx
- add di,ax
- mov cx,30*3/2
- rep movsw
-
- endm
-
- ;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-
- ; mov dx,3ceh
- ; mov ax,04005h
- ; out dx,ax
- ; mov ax,00104h
- ; out dx,ax
-
- mov ax,coord ; clear balls
- mov bx,coord+2
- call clr_ball
- mov ax,coord+4
- mov bx,coord+6
- call clr_ball
- mov ax,coord+8
- mov bx,coord+10
- call clr_ball
- mov ax,coord+12
- mov bx,coord+14
- call clr_ball
- mov ax,coord+16
- mov bx,coord+18
- call clr_ball
- mov ax,coord+20
- mov bx,coord+22
- call clr_ball
- mov ax,coord+24
- mov bx,coord+26
- call clr_ball
-
- mov ax,sinus_pt ; gestion trajectoire
- add ax,8
- and ax,2047
- mov sinus_pt,ax
-
- lea bx,sinus ; affichage balls
- add bx,ax ; 1
- mov dx,bx
- mov ax,[bx]
- mov bx,2[bx]
-
- mov coord,ax
- mov coord+2,bx
-
- call aff_ball
-
- add dx,32 ; 2
- mov bx,dx
- mov ax,[bx]
- mov bx,2[bx]
- mov coord+4,ax
- mov coord+6,bx
- call aff_ball
-
- add dx,32 ; 3
- mov bx,dx
- mov ax,[bx]
- mov bx,2[bx]
- mov coord+8,ax
- mov coord+10,bx
- call aff_ball
-
- add dx,32 ; 4
- mov bx,dx
- mov ax,[bx]
- mov bx,2[bx]
- mov coord+12,ax
- mov coord+14,bx
- call aff_ball
-
- add dx,32 ; 5
- mov bx,dx
- mov ax,[bx]
- mov bx,2[bx]
- mov coord+16,ax
- mov coord+18,bx
- call aff_ball
-
- add dx,32 ; 6
- mov bx,dx
- mov ax,[bx]
- mov bx,2[bx]
- mov coord+20,ax
- mov coord+22,bx
- call aff_ball
-
- add dx,32 ; 7
- mov bx,dx
- mov ax,[bx]
- mov bx,2[bx]
- mov coord+24,ax
- mov coord+26,bx
- call aff_ball
-
-
- ;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- in al,60h ; attend Space Bar pour arreter
- cmp al,39h
- jne main
-
- ;************************************
-
- cli
-
- mov cx,cs
- mov ds,cx
- lds dx,dword ptr timer ;ds = donnees
- mov ax,2508h
- int 21h ; replace ancienne Timer rout.
- mov ds,cx
-
- mov al,182 ; reprogramme Timer à 18.2 Hz
- out 43h,al
- mov al,0ffh ; 1193180/18.2 = 65535 = $ffff
- out 40h,al
- out 40h,al
-
- mov al,00000000b
- out 021h,al ; autorise all interrupts
- mov al,00000000b
- out 0a1h,al
-
- sti
-
- mov ax,0003h ; Mode Text 80x25
- int 10h
-
-
- mov ax,4c00h ; Exit
- int 21h
-
- ;***********************************************************
-
- ;---------------------------------
- ; sprite
- aff_ball proc near
-
- push ds
-
- xor ch,ch
-
- mov si,seg ball
- mov ds,si
- mov si,offset ball
-
- mov di,0a000h
- mov es,di
-
- mov cl,6
- sal bx,cl
- mov di,bx
- sal bx,1
- sal bx,1
- add di,bx
- add di,ax ;screen base + x + y*320
- cld
-
- include c:\masm\data\ball.asm
-
- pop ds
-
- ret
- aff_ball endp
-
- clr_ball proc near
-
- push ds
-
- xor ch,ch
-
- mov si,seg back
- mov ds,si
- mov si,offset back
-
- mov di,0a000h
- mov es,di
-
- mov cl,6
- sal bx,cl
- mov di,bx
- sal bx,1
- sal bx,1
- add di,bx
- add di,ax ;screen base + x + y*320
-
- add si,di
-
- cld
-
-
- include c:\masm\data\ball.fsm
-
- pop ds
-
- ret
- clr_ball endp
- ;---------------------------------
-
-
-
- ; port 3da bit 3
- wait_vbl proc near ; pour attendre la VBL
- mov dx,03DAh
- in al,dx
- and al,8h
- test al,8h
- jz V_Ready
- V_Not_Ready:
- in al,dx
- and al,8h
- test al,8h
- jz V_Not_Ready
- V_Ready:
- in al,dx
- and al,8h
- test al,8h
- jz V_Ready
- ret
-
- wait_vbl endp
-
- ; port 3da bit 0
- wait_hbl proc near ;attend HBL
-
- mov dx,3dah
- hbl:
- in al,dx
- and al,1
- test al,1
- jne hbl
-
- hbl2:
- in al,dx
- and al,1
- test al,0
- jne hbl2
-
- ret
-
- wait_hbl endp
-
- ;****************************************************************
-
- raster proc near ; Interruption Timer
-
- push dx
- push ax
- push si
- push ds
-
- mov si,cs
- mov ds,si
-
- mov dx,3c8h
- xor al,al
- out dx,al
- inc dx
- mov si,pok
- outsb
- outsb
- outsb
- mov pok,si
-
- mov al,20h ; EOI
- out 20h,al
-
- pop ds
- pop si
- pop ax
- pop dx
-
- iret
-
- raster endp
-
- pok dw (?)
- ;****************************************************************
-
- ;************** Section Data ****************
- colors_table:
- rept 300
- db 0,0,0
- endm
-
- colors_table2:
- rept 300
- db 0,0,0
- endm
-
- rolo1:
- ;rouleaux de 30 lignes
-
- ;bleu
- db 0,0,0,0,0,4,0,0,8,0,0,12,0,0,16,0,0,20,0,0,24,0,0,28,0,0,32
- db 0,0,36,0,0,40,0,0,44,0,0,48,0,0,52,0,0,56,0,0,60,0,4,56
- db 0,4,52,0,4,48,0,4,44,0,4,40,0,4,36,0,4,32,0,4,28,0,4,24
- db 0,4,20,0,4,16,0,4,12,0,4,8,0,4,4
-
- ;vert
- db 0,0,0,0,4,0,0,8,0,0,12,0,0,16,0,0,20,0,0,24,0,0,28,0,0,32,0
- db 0,36,0,0,40,0,0,44,0,0,48,0,0,52,0,0,56,0,0,60,0,4,56,0
- db 4,52,0,4,48,0,4,44,0,4,40,0,4,36,0,4,32,0,4,28,0,4,24,0
- db 4,20,0,4,16,0,4,12,0,4,8,0,4,4,0
-
- ;rouge
- db 0,0,0,4,0,0,8,0,0,12,0,0,16,0,0,20,0,0,24,0,0,28,0,0,32,0,0
- db 36,0,0,40,0,0,44,0,0,48,0,0,52,0,0,56,0,0,60,0,0,56,0,4
- db 52,0,4,48,0,4,44,0,4,40,0,4,36,0,4,32,0,4,28,0,4,24,0,4
- db 20,0,4,16,0,4,12,0,4,8,0,4,4,0,4
-
- ;rose
- db 0,0,0,4,0,4,8,0,8,12,0,12,16,0,16,20,0,20,24,0,24,28,0,28,32,0,32
- db 36,0,36,40,0,40,44,0,44,48,0,48,52,0,52,56,0,56,60,0,60,56,4,56
- db 52,4,52,48,4,48,44,4,44,40,4,40,36,4,36,32,4,32,28,4,28,24,4,24
- db 20,4,20,16,4,16,12,4,12,8,4,8,4,4,4
-
- ;jaune
- db 0,0,0,4,4,0,8,8,0,12,12,0,16,16,0,20,20,0,24,24,0,28,28,0,32,32,0
- db 36,36,0,40,40,0,44,44,0,48,48,0,52,52,0,56,56,0,60,60,0,56,56,4
- db 52,52,4,48,48,4,44,44,4,40,40,4,36,36,4,32,32,4,28,28,4,24,24,4
- db 20,20,4,16,16,4,12,12,4,8,8,4,4,4,4
-
- rolo_sin:
- include c:\masm\data\rolo.sin
- rolo_pt dw 0
-
- sinus:
- include c:\masm\data\sinus.dat
- sinus_pt dw 0
- coord dw 2*4 dup(0)
-
- fond:
- rept 30
- db 0,0,0
- endm
- db 0,0,0,0,0,0,0,0,1,0,0,1,0,0,2,0,0,2,0,0,3,0,0,3,0,0,4,0,0,4
- db 0,0,5,0,0,5,0,0,6,0,0,6,0,0,7,0,0,7,0,0,8,0,0,8,0,0,9,0,0,9
- db 0,0,10,0,0,10,0,0,11,0,0,11,0,0,12,0,0,12,0,0,13,0,0,13
- db 0,0,14,0,0,14,0,0,15,0,0,15,0,0,16,0,0,16,0,0,17,0,0,18
- db 0,0,19,0,0,19,0,0,20,0,0,20,0,0,21,0,0,21,0,0,22,0,0,22
- db 0,0,23,0,0,23,0,0,24,0,0,24,0,0,25,0,0,25,0,0,26,0,0,26
- db 0,0,27,0,0,27,0,0,28,0,0,28,0,0,29,0,0,29,0,0,30,0,0,30
- db 0,0,31,0,0,31,0,0,32,0,0,32,0,0,33,0,0,33,0,0,34,0,0,34
- db 0,0,35,0,0,35,0,0,36,0,0,36,0,0,37,0,0,37,0,0,38,0,0,38
- db 0,0,39,0,0,39,0,0,40,0,0,40,0,0,41,0,0,41,0,0,42,0,0,42
- db 0,0,43,0,0,43,0,0,44,0,0,44,0,0,45,0,0,45,0,0,46,0,0,46
- db 0,0,47,0,0,47,0,0,48,0,0,48,0,0,49,0,0,49,0,0,50,0,0,50
- db 0,0,51,0,0,51,0,0,52,0,0,52,0,0,53,0,0,53,0,0,54,0,0,54
- db 0,0,55,0,0,55,0,0,56,0,0,56,0,0,57,0,0,57,0,0,58,0,0,58
- db 0,0,59,0,0,59,0,0,60,0,0,60,0,0,61,0,0,61,0,0,62,0,0,62
- db 0,0,63,0,0,63
- rept 80
- db 0,0,0
- endm
-
- timer dw (?),(?) ; sauvegarde Segment et Offset routine Timer
-
- image db 'pcteam.map','$'
-
- palet:
- include c:\masm\data\pcteam.pal
-
- ;*******************************************
-
-
- code ends
- end maitre
-